cmake_minimum_required(VERSION 3.10)
project(griffon)

SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_BUILD_TYPE Release)

ADD_DEFINITIONS(-DSDL_MAIN_HANDLED)

# set include and lib dirs
IF (WIN32)
    # setup for windows
    SET(SDL2_INCLUDE_DIR "D:/Libs/SDL2/include/")
    SET(SDL2_LIBRARY "D:/Libs/SDL2/lib/SDL2.lib")
    SET(GLEW_INCLUDE_DIR "D:/Libs/glew/include/")
    SET(GLEW_LIBRARY "D:/Libs/glew/lib/glew32.lib")  
    
    if(MSVC)
        add_definitions(-D_CRT_SECURE_NO_WARNINGS)
    endif()

ELSE (WIN32)
    # setup for mac/linux
    SET(SDL2_INCLUDE_DIR "D:/Libs/SDL2/include/")
    SET(SDL2_LIBRARY "D:/Libs/SDL2/lib/SDL2.lib")
    SET(GLEW_INCLUDE_DIR "/usr/local/include")
    SET(GLEW_LIBRARY "/usr/local/lib/libGLEW.dylib")
ENDIF (WIN32)

# set additional include dirs
SET(GRIFFON_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/src/")

FIND_PACKAGE(OpenGL REQUIRED)

FILE(GLOB_RECURSE SOURCE_FILES "${PROJECT_SOURCE_DIR}/src/*.cpp")
FILE(GLOB_RECURSE SOURCE_C_FILES "${PROJECT_SOURCE_DIR}/src/*.c")
FILE(GLOB_RECURSE HEADER_FILES "${PROJECT_SOURCE_DIR}/src/*.h")

ADD_EXECUTABLE(
    griffon
    ${SOURCE_FILES}
    ${SOURCE_C_FILES}
    ${HEADER_FILES}
)

TARGET_INCLUDE_DIRECTORIES(
    griffon PRIVATE
    ${SDL2_INCLUDE_DIR}
    # ${GLEW_INCLUDE_DIR}
)

TARGET_LINK_LIBRARIES(
    griffon
    ${SDL2_LIBRARY}
    # ${GLEW_LIBRARY}
)
